<?php
$collection = isset($collection) ? $collection :false;
if ($collection) {
  $tag = Tag::with('imgs')->where('collection_id', '=', $collection->id)->where('name', '=', 'BIG')->first();
  if ($tag AND isset($tag->imgs[0])) {
    $big = $tag->imgs[0];
  } else {
    $big = $collection->imgs()->first();
  }

  $tag = Tag::with('imgs')->where('collection_id', '=', $collection->id)->where('name', '=', 'SMALL')->first();


  if ($tag AND isset($tag->imgs)) {
    $small = array_slice($tag->imgs, 0, 9);
  } else {
    $small = $collection->imgs()->take(9)->skip(1)->get();
  }
}
?>

    <div class='imgs' style='width:650px;height:100%;float:left;'>
      <?php $big_product = Product::find($big->product_id);?>
      <a href='/item/?id=<?php echo $big->id;?>'><img src='<?php echo $big->url;?>' title='<?php echo strip_tags($big_product->title);?>' class='big'></a>
      <?php foreach ($small as $s):?>
        <a target='_blank' href='/item/?id=<?php $product = Product::find($s->product_id);echo $s->id;?>'><img title='<?php echo strip_tags($product->title);?>' src='<?php echo $s->url . '_120x120.jpg';?>' class='small'/></a>
      <?php endforeach;?>
    </div>
